<script lang="ts" setup>
import { getProductsApi } from "@/api/products"
import { onMounted, ref } from "vue"

defineOptions({
  // 命名当前组件
  name: "ProductsCategoriesSelect"
})
const list = ref<any[]>([])
onMounted(async () => {
  const { data } = await getProductsApi({
    page: 1,
    size: 1000
  })
  list.value = data.list
})
</script>
<template>
  <el-select style="min-width: 180px">
    <el-option v-for="item in list" :key="item.id" :label="item.name" :value="item.id" />
  </el-select>
</template>
